package com.shopping.nacos;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * @className: ShoppingMemberApplication
 * @Description: 启动类
 * @author: JiaZhenpeng
 * @data: 2022/7/2923:14
 */
@SpringBootApplication
@EnableDiscoveryClient
public class ShoppingMemberApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(ShoppingMemberApplication.class, args);

        //打印nacos的配置数据到控制台
        for (; ; ) {
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            String userName = applicationContext.getEnvironment().getProperty("user.name");
            System.out.println("user name :" + userName);
        }
    }
}
